package com.woniu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.entity.vo.UserAppeal5VO;
import com.woniu.entity.vo.UserAppeal6VO;
import com.woniu.entity.vo.UserAppeal7VO;
import com.woniu.pojo.Appeal;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

/**
* @author Ma.Lei
* @description 针对表【t_appeal】的数据库操作Mapper
* @createDate 2022-12-16 23:27:25
* @Entity generator.domain.Appeal
*/
public interface AppealMapper extends BaseMapper<Appeal> {

    @Select("SELECT a.content,a.create_time,a.image_url,a.status from t_appeal a,\n" +
            "(SELECT id,price from t_order WHERE order_code=#{orderCode}) b \n" +
            "WHERE a.order_id=b.id; ")
    @ResultType(UserAppeal5VO.class)
    UserAppeal5VO selectAppeal5(String orderCode);

    @Select("SELECT a.content,a.create_time,a.image_url,a.status,a.handle_content,\n" +
            "a.update_time from t_appeal a,\n" +
            "(SELECT id,price from t_order WHERE order_code=#{orderCode}) b \n" +
            "WHERE a.order_id=b.id; ")
    @ResultType(UserAppeal6VO.class)
    UserAppeal6VO selectAppeal6(String orderCode);

    @Select("SELECT a.content,a.create_time,a.image_url,a.status,b.price,\n" +
            "a.update_time from t_appeal a,\n" +
            "(SELECT id,price from t_order WHERE order_code=#{orderCode}) b \n" +
            "WHERE a.order_id=b.id")
    @ResultType(UserAppeal7VO.class)
    UserAppeal7VO selectAppeal7(String orderCode);
    @Select("select id,order_id,content,image_url,create_time,status,modify_price,update_time,handle_content from t_appeal where order_id = #{orderId}")
    Appeal getAppealByOrderId(String orderId);
}




